﻿/**************************************************************
 * St. Sana - A file/folder scanner originall designed for    *
 * Open Media Library (open-media-library.googlecode.com)     *
 *                                                            *
 * Available for use by ANY project that wants to use it.     *
 * St. Sana is covered by the Apache 2 license.               *
 * Feel free to use this software however you like so as long *
 * as you follow the guidelines of above mentioned license.   *
 * Written by David J. Shultz (djshultz@gmail.com)            *
 **************************************************************/

using System;
using System.IO;
using System.Collections.Generic;

namespace StSana
{
    public class SSFolder
    {
        IList<SSFolder> subFolders;
        IList<SSFile> localFiles;
        IList<SSFolder> siblingFolders;

        #region properties
        public bool AppearsToContainAMovie
        {
            get; set;
        }
        public bool AppearsToContainATVShow
        {
            get; set;
        }
        public string FullPath
        {
            get; set;
        }
        public string Name
        {
            get; set;
        }
        public int Level
        {
            get; set;
        }
        public SSFolder ParentFolder
        {
            get; set;
        }
        public bool IsDiscFolder
        {
            get; set;
        }
        public Serf.DiscType DiscType
        {
            get; set;
        }
        #endregion

        public SSFolder(string name)
        {
            subFolders = new List<SSFolder>();
            siblingFolders = new List<SSFolder>();
            localFiles = new List<SSFile>();
            string[] parts = name.Split(Path.DirectorySeparatorChar);
            if (parts.Length > 0)
                Name = parts[parts.Length - 1];
            FullPath = Path.GetFullPath(name);
        }

        // copy constructor
        public SSFolder(SSFolder previousFolder)
        {
            throw new Exception("Dont copy this object!!");
        }

        public void AddFile(SSFile file)
        {
            localFiles.Add(file);
        }

        public void AddFolder(SSFolder folder)
        {
            subFolders.Add(folder);
        }

        public IList<SSFolder> SubFolders()
        {
            return subFolders;
        }

        public IList<SSFolder> SiblingFolders()
        {
            return siblingFolders;
        }

        public void AddSibling(SSFolder folder)
        {
            siblingFolders.Add(folder);
        }

        public IList<SSFile> LocalFiles()
        {
            return localFiles;
        }
    }
}
